package jssia.database.mysql.constants;


public enum Collation {
    BIG5_CHINESE_CI,
    BIG5_BIN,
    DEC8_SWEDISH_CI,
    DEC8_BIN,
    CP850_GENERAL_CI,
    CP850_BIN,
    HP8_ENGLISH_CI,
    HP8_BIN,
    KOI8R_GENERAL_CI,
    KOI8R_BIN,
    LATIN1_GERMAN1_CI,
    LATIN1_SWEDISH_CI,
    LATIN1_DANISH_CI,
    LATIN1_GERMAN2_CI,
    LATIN1_BIN,
    LATIN1_GENERAL_CI,
    LATIN1_GENERAL_CS,
    LATIN1_SPANISH_CI,
    LATIN2_CZECH_CS,
    LATIN2_GENERAL_CI,
    LATIN2_HUNGARIAN_CI,
    LATIN2_CROATIAN_CI,
    LATIN2_BIN,
    SWE7_SWEDISH_CI,
    SWE7_BIN,
    ASCII_GENERAL_CI,
    ASCII_BIN,
    UJIS_JAPANESE_CI,
    UJIS_BIN,
    SJIS_JAPANESE_CI,
    SJIS_BIN,
    HEBREW_GENERAL_CI,
    HEBREW_BIN,
    TIS620_THAI_CI,
    TIS620_BIN,
    EUCKR_KOREAN_CI,
    EUCKR_BIN,
    KOI8U_GENERAL_CI,
    KOI8U_BIN,
    GB2312_CHINESE_CI,
    GB2312_BIN,
    GREEK_GENERAL_CI,
    GREEK_BIN,
    CP1250_GENERAL_CI,
    CP1250_CZECH_CS,
    CP1250_CROATIAN_CI,
    CP1250_BIN,
    CP1250_POLISH_CI,
    GBK_CHINESE_CI,
    GBK_BIN,
    LATIN5_TURKISH_CI,
    LATIN5_BIN,
    ARMSCII8_GENERAL_CI,
    ARMSCII8_BIN,
    UTF8_GENERAL_CI,
    UTF8_BIN,
    UTF8_UNICODE_CI,
    UTF8_ICELANDIC_CI,
    UTF8_LATVIAN_CI,
    UTF8_ROMANIAN_CI,
    UTF8_SLOVENIAN_CI,
    UTF8_POLISH_CI,
    UTF8_ESTONIAN_CI,
    UTF8_SPANISH_CI,
    UTF8_SWEDISH_CI,
    UTF8_TURKISH_CI,
    UTF8_CZECH_CI,
    UTF8_DANISH_CI,
    UTF8_LITHUANIAN_CI,
    UTF8_SLOVAK_CI,
    UTF8_SPANISH2_CI,
    UTF8_ROMAN_CI,
    UTF8_PERSIAN_CI,
    UTF8_ESPERANTO_CI,
    UTF8_HUNGARIAN_CI,
    UCS2_GENERAL_CI,
    UCS2_BIN,
    UCS2_UNICODE_CI,
    UCS2_ICELANDIC_CI,
    UCS2_LATVIAN_CI,
    UCS2_ROMANIAN_CI,
    UCS2_SLOVENIAN_CI,
    UCS2_POLISH_CI,
    UCS2_ESTONIAN_CI,
    UCS2_SPANISH_CI,
    UCS2_SWEDISH_CI,
    UCS2_TURKISH_CI,
    UCS2_CZECH_CI,
    UCS2_DANISH_CI,
    UCS2_LITHUANIAN_CI,
    UCS2_SLOVAK_CI,
    UCS2_SPANISH2_CI,
    UCS2_ROMAN_CI,
    UCS2_PERSIAN_CI,
    UCS2_ESPERANTO_CI,
    UCS2_HUNGARIAN_CI,
    CP866_GENERAL_CI,
    CP866_BIN,
    KEYBCS2_GENERAL_CI,
    KEYBCS2_BIN,
    MACCE_GENERAL_CI,
    MACCE_BIN,
    MACROMAN_GENERAL_CI,
    MACROMAN_BIN,
    CP852_GENERAL_CI,
    CP852_BIN,
    LATIN7_ESTONIAN_CS,
    LATIN7_GENERAL_CI,
    LATIN7_GENERAL_CS,
    LATIN7_BIN,
    CP1251_BULGARIAN_CI,
    CP1251_UKRAINIAN_CI,
    CP1251_BIN,
    CP1251_GENERAL_CI,
    CP1251_GENERAL_CS,
    CP1256_GENERAL_CI,
    CP1256_BIN,
    CP1257_LITHUANIAN_CI,
    CP1257_BIN,
    CP1257_GENERAL_CI,
    BINARY,
    GEOSTD8_GENERAL_CI,
    GEOSTD8_BIN,
    CP932_JAPANESE_CI,
    CP932_BIN,
    EUCJPMS_JAPANESE_CI,
    EUCJPMS_BIN;

    private final CharacterSet charSet;

    private Collation() {
        String collation = toString();
        final int firstUnderscoreIndex = collation.indexOf('_');

        String charSetString = firstUnderscoreIndex == -1 ? collation : collation.substring(0, firstUnderscoreIndex);
        charSet = CharacterSet.valueOf(charSetString);
    }

    public CharacterSet getCharSet() {
        return charSet;
    }

    public enum CharacterSet {
        BIG5(BIG5_CHINESE_CI, "Big5 Traditional Chinese", 2),
        DEC8(DEC8_SWEDISH_CI, "DEC West European", 1),
        CP850(CP850_GENERAL_CI, "DOS West European", 1),
        HP8(HP8_ENGLISH_CI, "HP West European", 1),
        KOI8R(KOI8R_GENERAL_CI, "KOI8-R Relcom Russian", 1),
        LATIN1(LATIN1_SWEDISH_CI, "cp1252 West European", 1),
        LATIN2(LATIN2_GENERAL_CI, "ISO 8859-2 Central European", 1),
        SWE7(SWE7_SWEDISH_CI, "7bit Swedish", 1),
        ASCII(ASCII_GENERAL_CI, "US ASCII", 1),
        UJIS(UJIS_JAPANESE_CI, "EUC-JP Japanese", 3),
        SJIS(SJIS_JAPANESE_CI, "Shift-JIS Japanese", 2),
        HEBREW(HEBREW_GENERAL_CI, "ISO 8859-8 Hebrew", 1),
        TIS620(TIS620_THAI_CI, "TIS620 Thai", 1),
        EUCKR(EUCKR_KOREAN_CI, "EUC-KR Korean", 2),
        KOI8U(KOI8U_GENERAL_CI, "KOI8-U Ukrainian", 1),
        GB2312(GB2312_CHINESE_CI, "GB2312 Simplified Chinese", 2),
        GREEK(GREEK_GENERAL_CI, "ISO 8859-7 Greek", 1),
        CP1250(CP1250_GENERAL_CI, "Windows Central European", 1),
        GBK(GBK_CHINESE_CI, "GBK Simplified Chinese", 2),
        LATIN5(LATIN5_TURKISH_CI, "ISO 8859-9 Turkish", 1),
        ARMSCII8(ARMSCII8_GENERAL_CI, "ARMSCII-8 Armenian", 1),
        UTF8(UTF8_GENERAL_CI, "UTF-8 Unicode", 3),
        UCS2(UCS2_GENERAL_CI, "UCS-2 Unicode", 2),
        CP866(CP866_GENERAL_CI, "DOS Russian", 1),
        KEYBCS2(KEYBCS2_GENERAL_CI, "DOS Kamenicky Czech-Slovak", 1),
        MACCE(MACCE_GENERAL_CI, "Mac Central European", 1),
        MACROMAN(MACROMAN_GENERAL_CI, "Mac West European", 1),
        CP852(CP852_GENERAL_CI, "DOS Central European", 1),
        LATIN7(LATIN7_GENERAL_CI, "ISO 8859-13 Baltic", 1),
        CP1251(CP1251_GENERAL_CI, "Windows Cyrillic", 1),
        CP1256(CP1256_GENERAL_CI, "Windows Arabic", 1),
        CP1257(CP1257_GENERAL_CI, "Windows Baltic", 1),
        BINARY(Collation.BINARY, "Binary pseudo charset", 1),
        GEOSTD8(GEOSTD8_GENERAL_CI, "GEOSTD8 Georgian", 1),
        CP932(CP932_JAPANESE_CI, "SJIS for Windows Japanese", 2),
        EUCJPMS(EUCJPMS_JAPANESE_CI, "UJIS for Windows Japanese", 3);

        private final Collation defaultCollation;
        private final String description;
        private final int maxLength;

        private CharacterSet(Collation defaultCollation, String description, int maxLength) {
            this.defaultCollation = defaultCollation;
            this.description = description;
            this.maxLength = maxLength;
        }

        public Collation getDefaultCollation() {
            return defaultCollation;
        }

        public String getDescription() {
            return description;
        }

        public int getMaxLength() {
            return maxLength;
        }
    }
}
